//
//  TVChildViewModel.swift
//  iPhone
//
//  Created by Toj on 3/4/24.
//

import UIKit

class TVChildViewModel: NSObject {
    
    var tabName = ""
    
    private let tags = ["VIP", "TRIAL", "AD", ""]
    private let t_bcolors = [UIColor.yellow,
                             UIColor.blue,
                             UIColor.gray,
                             UIColor.white]

    private let urls = [
        "https://pics1.baidu.com/feed/91529822720e0cf3bcce889636ad5412bf09aa9f.jpeg@f_auto?token=9963b718e065e40047d333064f4ed7eb",
        "https://pics6.baidu.com/feed/0df3d7ca7bcb0a467ad6f422a07650296a60afdc.jpeg@f_auto?token=c3e0cc00ff4b4635dbb3292609676061",
        "https://pics2.baidu.com/feed/8cb1cb1349540923835d85dc584d7704b3de497b.jpeg@f_auto?token=35b14b42ae557bc1d0b5a25c22d246ac",
        "https://pics1.baidu.com/feed/7af40ad162d9f2d396ebe2d565f92c1e6327cc32.jpeg@f_auto?token=d4313d222857b760bb7b859f7cb27331",
        "https://pics2.baidu.com/feed/622762d0f703918f37c421899928809a59eec47b.jpeg@f_auto?token=a73d38f190eb296c50e15289dab2d4e0",
        "https://pics1.baidu.com/feed/0b55b319ebc4b74579e9d03304e9b81a8a8215bc.jpeg@f_auto?token=9a8d00ae8a69a8e9f53d26d0a8229547",
        "https://pics7.baidu.com/feed/9358d109b3de9c820f919464a794260718d8430c.jpeg@f_auto?token=23a163cb1b1dd52ae1a16fde51c43cfe",
        "https://pics7.baidu.com/feed/3812b31bb051f8190477216b16a1ece02e73e760.jpeg@f_auto?token=7c505a6239c3268bd9deebd74bec25af",
        "https://pics2.baidu.com/feed/00e93901213fb80e30359690fdc48923b83894b0.jpeg@f_auto?token=82c41e9b33bffef9ada9c88ff562531a",
        "https://pics1.baidu.com/feed/f2deb48f8c5494eebb46986a2c1e46f398257e51.jpeg@f_auto?token=1d0160869105a19c12bf28f3ccc8980e"
    ]
    
    func setupCellModels() -> [STTVCellModel] {
        let urlCount = urls.count
        let count = Int(arc4random_uniform(100)) + 10
        var cellModels = [STTVCellModel]()
        
        for i in 0..<count {
            let arcIndex = Int(arc4random_uniform(4))
            let urlIndex = Int(arc4random_uniform(UInt32(urlCount)))
            
            let cellModel = STTVCellModel()
            cellModel.tag = tags[arcIndex]
            cellModel.t_bcolor = t_bcolors[arcIndex]
            cellModel.t_tcolor = .white
            cellModel.name = "name: " + tabName + ", index: \(i)"
            cellModel.url = urls[urlIndex]
            
            cellModels.append(cellModel)
        }
        
        return cellModels
    }
}
